
l =[10,20,30,40,50,60]
print(l[:2])
print(l[2:])



s='bicycle'
#从第一个开始正数每三个
print(s[::3])
#从最后一个倒数
print(s[::-1])
print(s[::-2])

l = list(range(10))
print(l)
l[2:5] =[20,30]
print(l)
del l[5:7]
print(l)
l[3::2] = [11,22]
print(l)
l[2:5] = [100]
print(l)

l = [1,2,3]
print(l*5)
print(5 * 'abcd')


board = [['_'] * 3 for i in range(3)]
print(board)
print('\n')
board[1][2] = 'X'
print(board)
print('\n')
#以下的列表其实包含3个指向同一个列表的引用
weird_board =[['_'] * 3] * 3
print(weird_board)
print('\n')
weird_board[1][2] = 'o'
print(weird_board)
print('\n')

board = []
for i in range(3):
    row=['_'] * 3
    board.append(row)
print(board)
print('\n')
board[1][2] ='x'
print(board)